#include "udp_server.hpp"
#include <memory>
#include <cstdlib>

static void Usage(std::string proc)
{
    std::cout << "\nUsage: " << proc << " port\n" << std::endl;
}


// ./udp_server ip port
int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }

    //std::string ip = argv[1];
    uint16_t port = atoi(argv[1]);

    //智能指针
    std::unique_ptr<UdpServer> svr(new UdpServer(port));

    svr->initServer();

    svr->start();


    return 0;
}